import Vue from 'vue'
import Router from 'vue-router'
import Error from 'views/Error.vue'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/login',
      name: 'login',
      component: (resolve) => {require(['views/Login'], resolve)},
    },
    {
      path: '/',
      component: (resolve) => { require(['views/Main'], resolve) }, 
      meta: { requireAuth: true },
      children: [
        {
          path: 'LectureQuery',
          component: (resolve) => {require(['views/Lecture/LectureQuery'], resolve)},
          name: '讲座查询',
          children: [
            {
              path: 'LecturePanel/:id',
              component: (resolve) => {require(['views/Lecture/Query/LecturePanel'], resolve)},
              name: '讲座列表'
            },
            {
              path: 'applyLectuer/:id',
              component: (resolve) => {require(['views/Lecture/Query/applyLectuer'], resolve)},
              name: '讲座申请'
            }
          ]
        },
        {
          path: 'Welcome',
          component: (resolve) => {require(['views/Welcome'], resolve)},
          name: 'Welcome'
        },
        {
          path: 'repswd',
          component: (resolve) => {require(['views/User/RePswd'], resolve)},
          name: '修改密码'
        },
        {
          path: 'Me',
          component: (resolve) => {require(['views/User/Me'], resolve)},
          name: '我的信息'
        },
        {
          path: 'Rank',
          component: (resolve) => {require(['views/Rank/Rank'], resolve)},
          name: '排行榜单'
        },
        {
          path: 'Student',
          component: (resolve) => {require(['views/User/Student'], resolve)},
          name: '学生管理'
        },
        {
          path: 'Lecture',
          component: (resolve) => {require(['views/Lecture/Lecture'], resolve)},
          name: '讲座管理'
        },
        {
          path: 'Ticket',
          component: (resolve) => {require(['views/Ticket/Ticket'], resolve)},
          name: '票务发放'
        },
        {
          path: 'TicketM',
          component: (resolve) => {require(['views/Ticket/TicketM'], resolve)},
          name: '票务管理'
        },
        {
          path: 'MyTickets',
          component: (resolve) => {require(['views/User/MyTickets'], resolve)},
          name: '已选讲座'
        },
        {
          path:'*',
          component:Error,
          name: '错误请求'
        },    
      ]
    }
  ]
})
